﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;

using ChiDao.Component.Utils;
using ChiDao.Business.Models;
using ChiDao.Business.Models.FlowProcessNew;
using ChiDao.Site.Models;
using ChiDao.Business.Data.Repositories.FlowProcessNew;
using System.Xml;


namespace ChiDao.Business.Service.Impl
{
    [Export(typeof(IProcessedTaskService))]
    internal class ProcessedTaskService : IProcessedTaskService
    {
        [Import]
        protected IProcessedTaskRepository ProcessedTaskRepository { get; set; }

        public void AddProcessedTask(List<ProcessedTaskView> addList)
        {
            foreach (ProcessedTaskView processedTaskView in addList)
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    ID = processedTaskView.ID,
                    ProcessID = processedTaskView.ProcessID,
                    CurrentProcessNodeCode = processedTaskView.CurrentProcessNodeCode,
                    CurrentProcessNodeName = processedTaskView.CurrentProcessNodeName,
                    ApprovalOpinion = processedTaskView.ApprovalOpinion,
                    CurrentProcessPerson = processedTaskView.CurrentProcessPerson,
                    ProcessTime = processedTaskView.ProcessTime,
                    HandleState = processedTaskView.HandleState
                };
                ProcessedTaskRepository.Insert(processedTask);
            }
        }
    }
}